/**
 * SimpleControler Class
 * copyrigth 2006 © geolabs.Fr
 * GPL-2.0
 * gerald [ at ] geolabs [ dot ] fr
 *
 */      
SimpleControler=Controler.extend();

SimpleControler.define({

  _init: function(loading_image,map_image){
      this.content=document.getElementById(map_image);
      this.loading=document.getElementById(loading_image);
      this.status=document.getElementById("statusText");
      this.time=document.getElementById("timelog");
      this.fade=95;
    },

      setContent: function(){
      this.content.src=arguments[0];
    },

      setTime: function(){
      this.time.innerHTML=arguments[0];
    },

      reinitFade: function(){
      this.fade=10;
    },

      displayStatus: function(){
      this.superCall("displayStatus",arguments);
      this.loading.style.display="inline";
      Styler.setOpacity(this.loading,this.fade)
    },

      newData: function(){
      try{
	// View update
	this.displayStatus("Displaying");
	var tmp=new XmlToJson({xml:this.request.responseXML, root: "result", loop: "item"});
	tmp.createTree();
	
	this.setContent(tmp.tree.result.image_url);
	this.setTime(tmp.tree.result.time);

	this.request=null;

	Styler.setOpacity(this.loading,10);
	Styler.setOpacity(this.content,0);

	Effect.appear({id: this.content.id,start:0,limit:10});
	Effect.fade({id: this.loading.id,start:0,limit:6});
      }
      catch(e) {
	this.status.innerHTML="There was a problem retrieving the XML data:\n" +this.request.statusText+" "+e;
      }
    }
  });
